//
//  SDTestViewController.m
//  StudyDemo01
//
//  Created by 心晨 on 2024/6/2.
//

#import "SDTestViewController.h"
#import "AsyncDrawLabel.h"
#import "GPTestView.h"

@interface SDTestViewController ()

@property (nonatomic, strong) GPTestView *testView;

@property(nonatomic,strong)NSTimer *timer;

@end

@implementation SDTestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = UIColor.whiteColor;
    
    [self addTimer];
    
    AsyncDrawLabel *label = [[AsyncDrawLabel alloc] initWithFrame:CGRectMake(100, 100, 200, 20)];
    label.backgroundColor = UIColor.blueColor;
    label.text = @"异步绘制text";
    label.font = [UIFont systemFontOfSize:16];
    [self.view addSubview:label];
    [label.layer setNeedsDisplay];
    
    [self.view addSubview:self.testView];
    
}

- (void)viewDidLayoutSubviews {
    NSLog(@"viewDidLayoutSubviews ");
}

- (void)viewWillLayoutSubviews {
    NSLog(@"viewWillLayoutSubviews ");
}

- (void)addTimer {
//    _timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(updateTimer) userInfo:nil repeats:YES];
//    [[NSRunLoop mainRunLoop] addTimer:_timer forMode:NSRunLoopCommonModes];
}

- (void)updateTimer {
    NSLog(@"%s",__func__);
}

- (void)fooMethodA {
    NSLog(@"SDTestViewController fooMethodA");
}



- (GPTestView *)testView {
    if (!_testView) {
        _testView = [[GPTestView alloc] initWithFrame:CGRectMake(20, 200, self.view.bounds.size.width - 40, 100)];
        _testView.backgroundColor = UIColor.whiteColor;
    }
    return _testView;
}


@end
